package com.tw.ddd.trainning.umlhomework.parking;

import java.util.Arrays;

public class SortedParkingStrategy implements ParkingStrategy {
    @Override
    public ParkingLot chooseParkingLot(ParkingLot[] parkingLots) {
        if(parkingLots == null){
            return null;
        }

        for (int i = 0; i < parkingLots.length; i++) {
            if(parkingLots[i].isAvailable()){
                return parkingLots[i];
            }
        }

        return null;
    }
}
